<template>
  <!-- 评论 -->
  <div class="comment">
    <div class="explain clear-fix">
      <span class="left">用户评价</span>
      <span class="right">更多</span>
    </div>
    <div class="comment-list" v-for="item in comment" :key="item.created+item.rateId">
      <div class="user-info">
        <img :src="item.user.avatar" />
        <span>{{ item.user.uname }}</span>
      </div>
      <div class="content">{{ item.content }}</div>
      <div class="info-other">
        <span class="date">{{ item.created | newDate }}</span>
        <span class="prod-desc">{{ item.style }}</span>
        <div class="show-img">
          <img v-for="img in item.images" :key="img" :src="img" alt />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { formatDate } from "utils/formatDate";
export default {
  name: "comment",
  props: {
    comment: {
      type: Array,
      default() {
        return [];
      }
    }
  },
  data() {
    return {};
  },
  filters: {
    newDate(value) {
      let data = new Date(value * 1000);
      return formatDate(data, "yyyy-MM-dd");
    }
  }
};
</script>

<style lang="less" scoped>
.comment {
  padding: 10px;
  border-bottom: 10px solid #f2f5f8;
  .explain {
    padding: 15px 0;
    font-size: 14px;
    border-bottom: 1px solid #dedede;
  }
  .comment-list {
    margin: 10px 0;
    .user-info {
      img {
        width: 35px;
        height: 35px;
        border-radius: 50%;
        vertical-align: middle;
      }
      span {
        font-size: 13px;
        margin-left: 10px;
      }
    }
    .content {
      padding: 10px 0;
      font-size: 12px;
    }
    .info-other {
      font-size: 12px;
      color: #999;
      .data {
      }
      .prod-desc {
        padding-left: 8px;
      }
      .show-img {
        padding-top: 10px;
        img {
          width: 70px;
          height: 70px;
          margin-right: 5px;
        }
      }
    }
  }
}
</style>